<?php include_once 'layout/heard.php'?>
<?php $Config = Config::getInstance();
$getWebsite = $Config->getWebSiteConfig();?>
<body style="background:#f5f5f5; padding-bottom:50px;">

<div class="content head_bg">
	<div class="head">
        <div class="nav_ico">
        	<span class="ico01"></span>
            <span class="ico02"></span>
            <span class="ico03"></span>
        </div>
        <h1>订单列表</h1>
        <a href="?md=riders&cl=riders&at=messageConten" class="news_ico"><span><?php echo $newCount; ?></span></a>
    </div>
</div>

<div class="nav_hs"></div>
<div class="nav_bg">
    <div class="nav_com">
        <dl>
            <dd><img src="webroot/riders/images/logo.png"></dd>
            <dt><?php echo $_SESSION['riders']['tel']?></dt>
        </dl>
        <ul>
            <li id="riderReg" style="display: none"><a class="grxx" href="?md=riders&cl=riders&at=riders_approve">骑手认证</a></li>
            <li><a class="grxx" href="?md=riders&cl=riders&at=personageInfo">个人信息</a></li>
            <li><a class="lsdd" href="?md=riders&cl=riders&at=orderHistory">历史订单</a></li>
            <li><a class="wdqb" href="?md=riders&cl=riders&at=myWallet">我的钱包</a></li>
            <li><a class="cjwt" href="?md=riders&cl=riders&at=FQA">常见问题</a></li>
            <li><a class="xxzx" href="?md=riders&cl=riders&at=messageConten">消息中心</a></li>
        </ul>
    </div>
</div>
<div class="content order_list_bg">
	<div class="order_list">
    	<ul>
            <?php

            if($rsp_list){
            foreach($rsp_list as $v){
                if($v['shop_delivery_address']){
                    $address = $v['shop_delivery_address'];
                }else{
                    $address = $v['orders']['receiver_address'];
                }
                echo '	<li class="new_ico" id="express_'.$v['id'].'">
                <h3>
                	<p>'.$v['shop_delivery_time'].'&nbsp;前送达</p>
                    <span>￥<b>'.($v['express_fee']+$v['tip']).'</b></span>
                </h3>
                <h4>
                	<b>取货点：'.$v['orders']['shop_name'].'</b>
                
                	<span>'.$v['shop']['front_address'].'</span>
                </h4>
                <h5>收货点：'.$address.'</h5>
                <label>配送距离：<span>'.round($v['orders']['distance']/1000,2).'</span> 公里</label>
                <a class="a_bnt bnt_ljqd" href="javascript:void(0)" code="'.$v['id'].'">立即抢单</a>
            </li>';
            }
            }
            ?>
        </ul>
    </div>
</div>
<?php if($rsp_list){
    $display = 'style="display: none"';
}else{
    $display = '';
}
?>

<div class="content no_order" <?php echo $display?> >
	<dl>
        <dd><img src="webroot/riders/images/no_order_index.png"></dd>
        <dt>系统正在努力为你派单</dt>
    </dl>
</div>
<div class="menu_bg">
    <div class="content">
        <a class="a_xrw hov" href="?md=riders&cl=riders&at=OrdersList">
            <span></span>
            <p>新任务</p>
        </a>
        <a class="a_dqh " href="?md=riders&cl=riders&at=assignPick">
            <span></span>
            <p>待取货</p>
        </a>
        <a class="a_psz" href="?md=riders&cl=riders&at=dispatching">
            <span></span>
            <p>配送中</p>
        </a>
        <a class="a_ywc" href="?md=riders&cl=riders&at=finishOrderList">
            <span></span>
            <p>已完成</p>
        </a>
    </div>
</div>
<a class="bnt_refresh" href="javascript:location.reload();">刷新</a>

<div class="group_tc_bg" id="ljqd_pop">
    <div class="group_tc">
        <h3>温馨提示！</h3>
        <p>您是否确认抢单，恶意抢单再取消将会被平台惩罚哦！</p>
        <div class="bnt">
            <a href="javascript:void(0)" class="btn1">暂时不抢</a>
            <a href="javascript:void(0)" class="btn2">确认抢单</a>
        </div>
    </div>
</div>

<div class="group_tc_bg" id="zhty_pop">
    <div class="group_tc">
        <h3>很遗憾！</h3>
        <p>您的骑手资格已被门店停用，请联系门店人员，开启后才可恢复接单。</p>
        <div class="bnt">
            <a href="javascript:void(0)" class="btn1">暂不联系</a>
            <a href="tel:<?php echo $rsp_list[0]['shop']['tel'];?>" class="btn2">立即联系</a>
        </div>
    </div>
</div>

<div class="group_tc_bg" id="ridersT">
    <div class="group_tc">
        <h3>很遗憾！</h3>
        <p id="con"></p>
        <div class="bnt">
            <a href="javascript:void(0)" class="btn1">取消</a>
            <a href="?md=riders&cl=riders&at=riders_approve" class="btn2">再次认证</a>
        </div>
    </div>
</div>

<div class="group_tc_bg" id="ridersD">
    <div class="group_tc">
        <h3>很遗憾！</h3>
        <p>您当前尚未提交审核资料或尚未通过审核，请提交认证资料。</p>
        <div class="bnt">
            <a href="javascript:void(0)" class="btn1">取消</a>
            <a href="?md=riders&cl=riders&at=riders_approve" class="btn2">去认证</a>
        </div>
    </div>
</div>

<div class="group_tc_bg" id="ridersB">
    <div class="group_tc">
        <h3>很遗憾！</h3>
        <p>您提交审核资料不符合要求。</p>
        <div class="bnt">
            <a href="javascript:void(0)" class="btn1">取消</a>
            <a href="javascript:void(0)" class="btn2">确定</a>
        </div>
    </div>
</div>

<div class="group_tc_bg" id="Cancel">
    <div class="group_tc">
        <h3>取消配送取消提醒！</h3>
        <p></p>
        <div class="bnt">
            <a href="javascript:void(0)" class="btn1">取消</a>
            <a href="javascript:void(0)" class="btn2">查看</a>
        </div>
    </div>
</div>


<div class="group_tc_bg" id="ridersC">
    <div class="group_tc">
        <!--        <h3>很遗憾！</h3>-->
        <p>资料已提交 请耐心等待审核结果。</p>
        <div class="bnt">
            <a href="javascript:void(0)" class="btn1">取消</a>
<!--            <a href="--><?php //echo $getWebsite['website_url_w'];?><!--">先去微商城逛逛</a>-->
            <a href="javascript:void(0)" class="btn2">确定</a>
        </div>
    </div>
</div>
<?php include_once 'layout/rfooter.php'?>
<script>
        $.ajax({
            url:"?md=riders&cl=riders&at=ridersT",
            type:"post",
            dataType:"json",
            // data:{'tel':13888888888},
            success:function (d) {
                if(d.status == null){
                    popup("禁止操作,该账号存在异常");
                    setTimeout(function(){
                        window.location.href = "?md=riders&cl=riders&at=regriders";
                    }, 3000);

                }
                // (0=>"待审核",1=>"通过",2=>"禁用",3=>"未通过",4=>"骑手风控状态禁止接单"
                console.log(d)
                if( d.status == 1 && d.initiate == 2){  // 审核通过 但被停用
                    $("#zhty_pop").fadeIn();
                }
                if (d.status == 4) {                    // 审核通过 禁止接单
                    $("#zhty_pop").fadeIn();
                }

                if (d.status == 10) {  // 没有提交审核资料 / 刚注册 = 10
                    $("#ridersD").fadeIn();
                    $("#riderReg").show();
                }
                if(d.status == 0){      // 0 = 已经提交未审核
                    $("#ridersC").fadeIn();
                }

                if (d.status == 3){                     // 审核未通过
                    $("#con").html("骑手认证资料审核未通过，请查看未通过理由后，可重新填写再次提交认证。<br>未通过理由："+d.msg);
                    $("#ridersT").fadeIn();
                    $("#riderReg").show();
                }

                if (d.status == 2){                     // 审核未通过 不得申请
                    $("#ridersB").fadeIn();
                }
                if(d.status == 999){
                    popup(d.msg);
                }

            }
        })



        // ------------------------------------------------ 是否有被取消订单 --------------------------------------- //
        $(function () {
                $.ajax({
                    url: "?md=riders&cl=riders&at=getCanCelOrders",
                    type: "post",
                    dataType: "json",
                    success: function (d) {
                        if (d.status == 1) {
                            if (d.num > 0) {
                                $("#Cancel").find('p').html(d.msg);
                                $("#Cancel").fadeIn();
                            }
                        }
                    }
                })


        });

</script>

